﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections.Generic;

namespace NotesAgent
{
    [System.Xml.Serialization.XmlRootAttribute(Namespace = "",
                 IsNullable = false)]
    public class Result
    {
        public string message;
        public string err;
        public List<note> notes;

        public Result()
        {
            message = "";
            err = "0";
            notes = new List<note>();
        }

        public void UpdateChars()
        {
            for (int i = 0; i < notes.Count; i++)
            {
                var item = notes[i];
                item.Title = Storage.CheckUtf8Chars(item.Title);
                item.Text = Storage.CheckUtf8Chars(item.Text);
               
            }


        }
    }

    public class note
    {
        public long Id = 0;
        public string Title = "";
        public string Text = "";
        public string Created = "";
        public string Modified = "";
        public string Payload = "";
        public int Type = 0;

        public override bool Equals(object obj)
        {
            if(!(obj is note))
                return base.Equals(obj);
            var n = (note)obj;

            return n.Id == Id &&
                n.Type == Type &&
                n.Title == Title &&
                n.Text == Text &&
                n.Modified == Modified &&
                n.Created == Created &&
                n.Payload == Payload;
        }
        public override int GetHashCode()
        {
            return base.GetHashCode();
        }
    }
}
